#include <stdio.h>

#define ARRAY_SIZE 6

int main() {
    int array[ARRAY_SIZE] = {5,6,1,5,2,9};
    int max_idx = 0;
    int idx = 1;
    for(; max_idx < ARRAY_SIZE; ++max_idx) {
        for(; idx < ARRAY_SIZE; ++idx) {
            if(array[max_idx] < array[idx]) {
                int tmp = array[max_idx];
                array[max_idx] = array[idx];
                array[idx] = tmp;
            }
        }
        // ++max_idx;
        idx = max_idx + 1;
    }
    for(int i = 0; i < ARRAY_SIZE; ++i) {
        printf("%d ", array[i]);
    }
    printf("\n");
    return 0;
}